package trycatchDemo;

public class Test3 {
    public static void main(String[] args) {
        int[] arr = {1, 2, 3, 4};
        String s = null;
        try {
            System.out.println(arr[10]);

        }
        catch (ArrayIndexOutOfBoundsException e) {
            System.out.println("越界");
        }

        try{
            System.out.println(2/0);
        }
        catch (ArithmeticException a) {
            System.out.println("除数");
        }

        try{

            System.out.println(s.equals("a"));
        }
        catch (NullPointerException b) {
            System.out.println("空指针");
        }

        System.out.println("==============");
    }
}
